package com.syq.web;

import com.syq.bean.Student;
import com.syq.service.StudentService;
import com.syq.service.impl.StudentServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.PrintWriter;
@WebServlet(urlPatterns = "/Educational/student/findbysno")
public class AjxsIdServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String sno = req.getParameter("sno");
        StudentService service = new StudentServiceImpl();
        Student student = service.finByNo(sno);
        resp.setContentType("text/html;charset=utf-8");
        PrintWriter writer = resp.getWriter();
        if(student!=null) {
            writer.println("该学生已存在");
        } else{
            writer.println("该学号可用");
        }
    }
}
